<%--
 *  File:    ChartofGLAccountSummary.jsp
 *  @Author: Stephen Liu
 *  Date:    Wednesday, January 14, 2004

 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>

<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.*" %>

<%@ page contentType ="text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  Category cat = Category.getInstance("jsp.ChartofGLAccountSummary");
  String strModuleName = "GL";
  String privilegeCode = "40108";
  String strTableName = "ovglaccountlistsummary";
%>

<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/SessionTimeout.inc" %>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>

<html>
<head>
<title>chartofglaccountsummary</title>
<PageFlow:CheckPageFlow pageName="chartofglaccountsummary"/>
<%@ include file="/inc/SumDiv.inc" %>
<%
  HashMap userinfo = (HashMap) session.getAttribute("userinfo");
  if (userinfo == null)
    userinfo = new HashMap();

  Vector glaccountlistsummary = (Vector) pageContext.getAttribute("glaccountlistsummary");
  if (glaccountlistsummary == null)
    glaccountlistsummary = new Vector();

  String strClassType = "none";
%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="../js/ScriptLib.js"></script>
<script language="JavaScript" src="../js/SummaryDivision.js"></script>
<script language="JavaScript">
function page_summary(actionvalue, orderbyname) {
  parent.down.location.href = "../common/Blank.jsp?<%= OvalTools.randomURL() %>";

  var editform = summaryPrepare(frm, actionvalue, orderbyname);
  editform.action = "ChartofGLAccountSummary.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}

function page_radiotrue(idname, id)
{
  if (frm.glaccountlistid.value != id && parent.down.location.href.search("Blank.jsp") == -1) {
    parent.down.location.href = "../common/Blank.jsp?<%= OvalTools.randomURL() %>";
  }
  radiotrue(idname);
  frm.glaccountlistid.value = id;
}

function page_new() {
  parent.down.location.href = "ChartofGLAccountNew.jsp?<%= OvalTools.randomURL() %>";
}

function page_edit() {
  if (isEmpty(frm.glaccountlistid.value)) {
    alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
    return;
  }
  parent.down.location.href = "ChartofGLAccountEdit.jsp?<%= OvalTools.randomURL() %>&glaccountlistid=" + frm.glaccountlistid.value;
}

function page_delete() {
  if (isEmpty(frm.glaccountlistid.value)) {
    alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
    return;
  }
  if(!confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>"))
    return;

  parent.down.location.href = "../common/Blank.jsp?<%= OvalTools.randomURL() %>";

  frm.actionname.value = "delete";
  frm.target = "_self";
  isRunning = true;
  frm.submit();
}

function page_accountlist() {
  if (isEmpty(frm.glaccountlistid.value)) {
    alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
    return;
  }
  parent.location.href = "ControlGLAccountMgmtFrm.jsp?<%= OvalTools.randomURL() %>&glaccountlistid=" + frm.glaccountlistid.value;
}

function page_viewusedorg() {
  if (isEmpty(frm.glaccountlistid.value)) {
    alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
    return;
  }
  parent.down.location.href = "ChartofGLAccountUsedOrgList.jsp?<%= OvalTools.randomURL() %>&glaccountlistid=" + frm.glaccountlistid.value;
}

function page_export() {

}
</script>

</head>
<body>
<form name="frm" method="post" action="../Dispatcher">
  <input type="hidden" name="pagename" value="chartofglaccountsummary">
  <input type="hidden" name="actionname">

  <input type="hidden" name="glaccountlistid">

  <%@ include file="/inc/PageLocation.inc" %>
  <table width="100%" cellspacing="0" border="0" cellpadding="0">
    <tr>
      <td>
        <table width="100%" border="0" cellspacing="0">
          <tr>
            <td class="summary_top" colspan="2"></td>
          </tr>
          <%@ include file="/inc/SummarySearch.inc" %>
        </table>
      </td>
    </tr>
    <tr>
      <td>
        <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
          <tr class="deepblue-left">
            <td width="27" class="title_center">&nbsp;</td>
            <td width="100" class="title_center"><a href="javascript:page_summary('orderby','glaccountlistcode')"><%= label.getLabelName("L_SubjectCode") %></a></td>
            <td class="title_center"><a href="javascript:page_summary('orderby','description')"><%= label.getLabelName("L_RptDescription") %></a></td>
            <td class="title_center" width="80"><a href="javascript:page_summary('orderby','glaccountstructure')"><%= label.getLabelName("L_GLAccountStructure") %></a></td>
            <td class="title_center" width="80"><a href="javascript:page_summary('orderby','makername')"><%= label.getLabelName("L_Maker") %></a></td>
            <td class="title_center" width="80"><a href="javascript:page_summary('orderby','createdate')"><%= label.getLabelName("L_CreateDate") %></a></td>
            <td class="title_center" width="60"><a href="javascript:page_summary('orderby','statusname')"><%= label.getLabelName("L_Status") %></a></td>
          </tr>
          <logic:iterate id="list" collection="<%= glaccountlistsummary %>" indexId="idx">
          <%
            int i = idx.intValue();
            strClassType = (i % 2 == 1) ? "td-listrom" : "none";
          %>
          <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'" class="<%=JspHelper.filterNull( strClassType )%>" onClick="javascript:page_radiotrue('glaccountlistid<%=JspHelper.filterNull( i )%>','<custom:write name="list" property="glaccountlistid"/>')">
            <td>
              <input type="radio" id="glaccountlistid<%=JspHelper.filterNull( i )%>" name="listid" value="<custom:write name="list" property="glaccountlistid"/>" class="normalradio" <% if (i == 0) { %>checked<% } %>>
            </td>
            <td><a href="ChartofGLAccountInfo.jsp?<%= OvalTools.randomURL() %>&glaccountlistid=<custom:write name="list" property="glaccountlistid"/>" target="down"><custom:write name="list" property="glaccountlistcode" nbsp="true"/></a></td>
            <td><custom:write name="list" property="description" nbsp="true"/></td>
            <td><custom:write name="list" property="glaccountstructure" nbsp="true"/></td>
            <td><custom:write name="list" property="makername" nbsp="true"/></td>
            <td class="td_right"><custom:write name="list" property="createdate" dataFormatName="dateformat" nbsp="true"/></td>
            <td><custom:write name="list" property="statusname" nbsp="true"/></td>
          </tr>
          <% if (i == 0) { %>
          <script languagecode="javascript">page_radiotrue('glaccountlistid0','<custom:write name="list" property="glaccountlistid"/>')</script>
          <% } %>
          </logic:iterate>
          <%@ include file="/inc/SummaryAction.inc" %>
        </table>
        <table width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="td_center">
              <%
                int grade = userinfo.get("grade") != null ? ((Integer) userinfo.get("grade")).intValue() : 0;
                if (grade == 1) {
              %>
              <a onclick="javascript:page_new()"><custom:button type="1" label="L_New" border="0" style="width:60"/></a>
              <a onclick="javascript:page_edit()"><custom:button type="1" label="L_Edit" border="0" style="width:60"/></a>
              <a onclick="javascript:page_delete()"><custom:button type="1" label="L_Delete" border="0" style="width:60"/></a>
              <% } %>
              <a onclick="javascript:page_accountlist()"><custom:button type="1" label="L_GLAccountList" border="0"/></a>
              <a onclick="javascript:page_viewusedorg()"><custom:button type="1" label="L_ViewReferer" border="0"/></a>
              <!--a onclick="javascript:page_export()"><custom:button type="1" label="L_ExportGLAccountList" border="0"/></a-->
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
</form>
<%@ include file="/inc/AlertError.inc" %>
</body>
</html>
